﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using Dictionary.ERP;
using Common;
using Security.ERP;
using Extra.ERP;
using Common.Report;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;

namespace Dictionary
{
    public class xucHoliday : xucBase
    {
        private readonly Common.Class.clsAllOption clsAllOption =
            new Common.Class.clsAllOption();

        private Bar bar2;
        private BarDockControl barDockControlBottom;
        private BarDockControl barDockControlLeft;
        private BarDockControl barDockControlRight;
        private BarDockControl barDockControlTop;
        private BarManager barManager1;
        private BarEditItem bbeYear;
        private BarButtonItem bbiAdd;
        private BarButtonItem bbiClose;
        private BarButtonItem bbiDelete;
        private BarButtonItem bbiEdit;
        private BarButtonItem bbiExport;
        private BarButtonItem bbiPrint;
        private BarButtonItem bbiReload;

        private GridColumn colDescription;
        private GridColumn colFromDate;
        private GridColumn colHolidayID;
        private GridColumn colHolidayName;
        private GridColumn colToDate;
        private IContainer components;
        private GridView gbList;
        private GridControl gcList;
        public ImageCollection imageCollection2;
        private int m_Year;
        private RepositoryItemTimeEdit repMonth;
        private RepositoryItemTimeEdit repYear;

        public xucHoliday()
        {
            InitializeComponent();
            Init();
            ReLoad();
        }

        private void Add()
        {
            if (MyRule.IsAdd("bbiHoliday"))
            {
                var add = new xfmHolidayAdd(Common.Class.Actions.Add);
                add.Added += frm_Added;
                add.ShowDialog();
            }
        }

        private void bbiAdd_ItemClick(object sender, ItemClickEventArgs e)
        {
            Add();
        }

        private void bbiClose_ItemClick(object sender, ItemClickEventArgs e)
        {
            (base.Parent as XtraForm).Close();
        }

        private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (MyRule.IsDelete("bbiHoliday"))
            {
                bool flag = false;
                int[] selectedRows = gbList.GetSelectedRows();
                if (
                    XtraMessageBox.Show("Bạn c\x00f3 muốn x\x00f3a kh\x00f4ng?", "Th\x00f4ng b\x00e1o",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)
                {
                    string str;
                    object rowCellValue;
                    base.SetWaitDialogCaption("Đang x\x00f3a...");
                    var dic_holiday = new DIC_HOLIDAY();
                    for (int i = selectedRows.Length; i > 0; i--)
                    {
                        flag = true;
                        rowCellValue = gbList.GetRowCellValue(selectedRows[i - 1], "HolidayID");
                        if (rowCellValue != null)
                        {
                            SYS_LOG.Insert("Danh S\x00e1ch Ng\x00e0y Nghỉ, Ng\x00e0y Lể", "Xo\x00e1",
                                rowCellValue.ToString());
                            str = dic_holiday.Delete(new Guid(rowCellValue.ToString()));
                            if (str == "OK")
                            {
                                gbList.DeleteRow(selectedRows[i - 1]);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a" + str, "Th\x00f4ng b\x00e1o",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                        }
                    }
                    this.DoHide();
                    if (!flag)
                    {
                        rowCellValue = gbList.GetFocusedRowCellValue("HolidayID");
                        if (rowCellValue != null)
                        {
                            SYS_LOG.Insert("Danh S\x00e1ch Ng\x00e0y Nghỉ, Ng\x00e0y Lể", "Xo\x00e1",
                                rowCellValue.ToString());
                            base.SetWaitDialogCaption("Đang x\x00f3a...");
                            str = dic_holiday.Delete(new Guid(rowCellValue.ToString()));
                            if (str == "OK")
                            {
                                gbList.DeleteRow(gbList.FocusedRowHandle);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a" + str, "Th\x00f4ng b\x00e1o",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            this.DoHide();
                        }
                    }
                }
            }
        }

        private void bbiEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            Change();
        }

        private void bbiExport_ItemClick(object sender, ItemClickEventArgs e)
        {
            base._exportView = gbList;
            SYS_LOG.Insert("Danh S\x00e1ch Ng\x00e0y Nghỉ, Ng\x00e0y Lể", "Xuất");
            base.Export();
        }

        private void bbiPrint_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (MyRule.IsPrint("bbiHoliday"))
            {
                SYS_LOG.Insert("Danh S\x00e1ch Ng\x00e0y Nghỉ, Ng\x00e0y Lể", "In");
                new xfmReport("Danh Mục").ShowPrintPreview(gcList);
            }
        }

        private void bbiReload_ItemClick(object sender, ItemClickEventArgs e)
        {
            ReLoad();
        }

        private void Change()
        {
            if (MyRule.IsEdit("bbiHoliday"))
            {
                var item = new DIC_HOLIDAY();
                object focusedRowCellValue = gbList.GetFocusedRowCellValue("HolidayID");
                if (focusedRowCellValue != null)
                {
                    base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                    if (item.Get(focusedRowCellValue.ToString()) != "OK")
                    {
                        this.DoHide();
                        XtraMessageBox.Show("Dữ liệu kh\x00f4ng tồn tại", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        this.DoHide();
                        var add = new xfmHolidayAdd(Common.Class.Actions.Update, item);
                        add.Updated += frm_Updated;
                        add.Added += frm_Added;
                        add.ShowDialog();
                    }
                }
            }
        }

        public void DisableMenu(bool disable)
        {
            bbiEdit.Enabled = !disable;
            bbiDelete.Enabled = !disable;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        protected void DoShowMenu(GridHitInfo hi)
        {
            if (hi.HitTest == GridHitTest.ColumnButton)
            {
                var menu = new GridViewColumnButtonMenu(gbList);
                menu.Init(hi);
                menu.Show(hi.HitPoint);
            }
        }

        private void frm_Added(object sender, DIC_HOLIDAY Item)
        {
            LoadGrid();
        }

        private void frm_Updated(object sender, DIC_HOLIDAY Item)
        {
            UpdateRow(Item);
        }

        private void gbList_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
        {
            if (e.RowHandle == -2147483648)
            {
                e.Handled = true;
                e.Painter.DrawObject(e.Info);
                Rectangle bounds = e.Bounds;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0x3f, 0xa5, 0xa5, 0)), bounds);
                bounds.Height--;
                bounds.Width--;
                e.Graphics.DrawRectangle(Pens.Blue, bounds);
            }
            int rowHandle = e.RowHandle;
            if (rowHandle >= 0)
            {
                rowHandle++;
                e.Info.DisplayText = rowHandle.ToString();
            }
        }

        private void gbList_DoubleClick(object sender, EventArgs e)
        {
            if (gbList.RowCount != 0)
            {
                Change();
            }
        }

        private void gbList_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            SetMenu(null);
        }

        private void gbList_KeyDown(object sender, KeyEventArgs e)
        {
        }

        private void gbList_MouseDown(object sender, MouseEventArgs e)
        {
        }

        private void gbList_RowCellClick(object sender, RowCellClickEventArgs e)
        {
        }

        private void Init()
        {
            bbeYear.EditValue = clsAllOption.MonthDefault;
            m_Year = clsAllOption.MonthDefault.Year;
            repYear.EditValueChanged += repYear_EditValueChanged;
            repYear.EditValueChanging += repYear_EditValueChanging;
        }

        private void InitializeComponent()
        {
            components = new Container();
            var manager = new ComponentResourceManager(typeof (xucHoliday));
            var condition = new StyleFormatCondition();
            var condition2 = new StyleFormatCondition();
            var condition3 = new StyleFormatCondition();
            var condition4 = new StyleFormatCondition();
            var condition5 = new StyleFormatCondition();
            barManager1 = new BarManager(components);
            bar2 = new Bar();
            bbeYear = new BarEditItem();
            repYear = new RepositoryItemTimeEdit();
            bbiAdd = new BarButtonItem();
            bbiDelete = new BarButtonItem();
            bbiEdit = new BarButtonItem();
            bbiPrint = new BarButtonItem();
            bbiExport = new BarButtonItem();
            bbiReload = new BarButtonItem();
            bbiClose = new BarButtonItem();
            barDockControlTop = new BarDockControl();
            barDockControlBottom = new BarDockControl();
            barDockControlLeft = new BarDockControl();
            barDockControlRight = new BarDockControl();
            imageCollection2 = new ImageCollection(components);
            repMonth = new RepositoryItemTimeEdit();
            gcList = new GridControl();
            gbList = new GridView();
            colHolidayID = new GridColumn();
            colHolidayName = new GridColumn();
            colFromDate = new GridColumn();
            colToDate = new GridColumn();
            colDescription = new GridColumn();
            barManager1.BeginInit();
            repYear.BeginInit();
            imageCollection2.BeginInit();
            repMonth.BeginInit();
            gcList.BeginInit();
            gbList.BeginInit();
            base.SuspendLayout();
            barManager1.Bars.AddRange(new[] {bar2});
            barManager1.DockControls.Add(barDockControlTop);
            barManager1.DockControls.Add(barDockControlBottom);
            barManager1.DockControls.Add(barDockControlLeft);
            barManager1.DockControls.Add(barDockControlRight);
            barManager1.Form = this;
            barManager1.Images = imageCollection2;
            barManager1.Items.AddRange(new BarItem[]
            {bbeYear, bbiAdd, bbiDelete, bbiEdit, bbiPrint, bbiExport, bbiClose, bbiReload});
            barManager1.MainMenu = bar2;
            barManager1.MaxItemId = 0x10;
            barManager1.RepositoryItems.AddRange(new RepositoryItem[] {repMonth, repYear});
            bar2.BarName = "Main menu";
            bar2.DockCol = 0;
            bar2.DockRow = 0;
            bar2.DockStyle = BarDockStyle.Top;
            bar2.LinksPersistInfo.AddRange(new[]
            {
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbeYear, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiAdd, "", true, true, true, 0, null,
                    BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiDelete, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiEdit, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiPrint, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiExport, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiReload, BarItemPaintStyle.CaptionGlyph),
                new LinkPersistInfo(BarLinkUserDefines.PaintStyle, bbiClose, "", true, true, true, 0, null,
                    BarItemPaintStyle.CaptionGlyph)
            });
            bar2.OptionsBar.AllowQuickCustomization = false;
            bar2.OptionsBar.DrawDragBorder = false;
            bar2.OptionsBar.MultiLine = true;
            bar2.OptionsBar.UseWholeRow = true;
            bar2.Text = "Main menu";
            bbeYear.Caption = "Năm:";
            bbeYear.Edit = repYear;
            bbeYear.Id = 4;
            bbeYear.Name = "bbeYear";
            bbeYear.Width = 70;
            repYear.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            repYear.Appearance.Options.UseFont = true;
            repYear.AutoHeight = false;
            repYear.Buttons.AddRange(new[] {new EditorButton()});
            repYear.Mask.EditMask = "yyyy";
            repYear.Name = "repYear";
            bbiAdd.Caption = "Th\x00eam";
            bbiAdd.Id = 9;
            bbiAdd.ImageIndex = 6;
            bbiAdd.Name = "bbiAdd";
            bbiAdd.ItemClick += bbiAdd_ItemClick;
            bbiDelete.Caption = "X\x00f3a";
            bbiDelete.Id = 10;
            bbiDelete.ImageIndex = 13;
            bbiDelete.Name = "bbiDelete";
            bbiDelete.ItemClick += bbiDelete_ItemClick;
            bbiEdit.Caption = "Sửa";
            bbiEdit.Id = 11;
            bbiEdit.ImageIndex = 14;
            bbiEdit.Name = "bbiEdit";
            bbiEdit.ItemClick += bbiEdit_ItemClick;
            bbiPrint.Caption = "In";
            bbiPrint.Id = 12;
            bbiPrint.ImageIndex = 9;
            bbiPrint.Name = "bbiPrint";
            bbiPrint.ItemClick += bbiPrint_ItemClick;
            bbiExport.Caption = "Xuất";
            bbiExport.Id = 13;
            bbiExport.ImageIndex = 0x31;
            bbiExport.Name = "bbiExport";
            bbiExport.ItemClick += bbiExport_ItemClick;
            bbiReload.Caption = "Nạp Lại";
            bbiReload.Id = 15;
            bbiReload.ImageIndex = 0x2a;
            bbiReload.Name = "bbiReload";
            bbiReload.ItemClick += bbiReload_ItemClick;
            bbiClose.Caption = "Đ\x00f3ng";
            bbiClose.Id = 14;
            bbiClose.ImageIndex = 0x16;
            bbiClose.Name = "bbiClose";
            bbiClose.ItemClick += bbiClose_ItemClick;
            imageCollection2.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection2.ImageStream");
            imageCollection2.Images.SetKeyName(0x3d, "Vista (35).ico");
            imageCollection2.Images.SetKeyName(0x3e, "Security.ico");
            imageCollection2.Images.SetKeyName(0x3f, "RibbonPrintPreview_DocumentMapLarge.png");
            repMonth.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            repMonth.Appearance.Options.UseFont = true;
            repMonth.AutoHeight = false;
            repMonth.Buttons.AddRange(new[] {new EditorButton()});
            repMonth.Mask.EditMask = "MM";
            repMonth.Name = "repMonth";
            gcList.Dock = DockStyle.Fill;
            gcList.EmbeddedNavigator.Buttons.Append.Visible = false;
            gcList.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
            gcList.EmbeddedNavigator.Buttons.Edit.Visible = false;
            gcList.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
            gcList.EmbeddedNavigator.Buttons.Remove.Visible = false;
            gcList.EmbeddedNavigator.TextStringFormat = "{0}/{1}";
            gcList.Location = new Point(0, 0x1a);
            gcList.MainView = gbList;
            gcList.Name = "gcList";
            gcList.Size = new Size(0x2b3, 0x1a6);
            gcList.TabIndex = 4;
            gcList.UseEmbeddedNavigator = true;
            gcList.ViewCollection.AddRange(new BaseView[] {gbList});
            gbList.Appearance.GroupRow.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            gbList.Appearance.GroupRow.Options.UseFont = true;
            gbList.Columns.AddRange(new[] {colHolidayID, colHolidayName, colFromDate, colToDate, colDescription});
            condition.Appearance.ForeColor = Color.FromArgb(0x40, 0x40, 0x40);
            condition.Appearance.Options.UseForeColor = true;
            condition.ApplyToRow = true;
            condition.Condition = FormatConditionEnum.Equal;
            condition.Value1 = 0;
            condition2.Appearance.BackColor = Color.Snow;
            condition2.Appearance.ForeColor = Color.RoyalBlue;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.ApplyToRow = true;
            condition2.Condition = FormatConditionEnum.Equal;
            condition2.Value1 = 1;
            condition3.Appearance.BackColor = Color.SeaShell;
            condition3.Appearance.ForeColor = Color.ForestGreen;
            condition3.Appearance.Options.UseForeColor = true;
            condition3.ApplyToRow = true;
            condition3.Condition = FormatConditionEnum.Equal;
            condition3.Value1 = 2;
            condition4.Appearance.BackColor = Color.Linen;
            condition4.Appearance.ForeColor = Color.DarkGoldenrod;
            condition4.Appearance.Options.UseForeColor = true;
            condition4.ApplyToRow = true;
            condition4.Condition = FormatConditionEnum.Equal;
            condition4.Value1 = 3;
            condition5.Appearance.BackColor = Color.FloralWhite;
            condition5.Appearance.ForeColor = Color.Red;
            condition5.Appearance.Options.UseForeColor = true;
            condition5.ApplyToRow = true;
            condition5.Condition = FormatConditionEnum.Equal;
            condition5.Value1 = 4;
            gbList.FormatConditions.AddRange(new[] {condition, condition2, condition3, condition4, condition5});
            gbList.GridControl = gcList;
            gbList.GroupPanelText = "K\x00e9o v\x00e0 Thả cột v\x00e0o đ\x00e2y để nh\x00f3m dữ liệu";
            gbList.IndicatorWidth = 40;
            gbList.Name = "gbList";
            gbList.OptionsBehavior.AllowIncrementalSearch = true;
            gbList.OptionsBehavior.AutoExpandAllGroups = true;
            gbList.OptionsBehavior.CopyToClipboardWithColumnHeaders = false;
            gbList.OptionsBehavior.FocusLeaveOnTab = true;
            gbList.OptionsLayout.StoreAllOptions = true;
            gbList.OptionsLayout.StoreAppearance = true;
            gbList.OptionsMenu.EnableColumnMenu = false;
            gbList.OptionsMenu.EnableGroupPanelMenu = false;
            gbList.OptionsNavigation.EnterMoveNextColumn = true;
            gbList.OptionsSelection.EnableAppearanceFocusedCell = false;
            gbList.OptionsSelection.InvertSelection = true;
            gbList.OptionsSelection.MultiSelect = true;
            gbList.OptionsView.RowAutoHeight = true;
            gbList.OptionsView.ShowAutoFilterRow = true;
            gbList.OptionsView.ShowGroupPanel = false;
            gbList.CustomDrawRowIndicator += gbList_CustomDrawRowIndicator;
            gbList.DoubleClick += gbList_DoubleClick;
            colHolidayID.Caption = "M\x00e3 ng\x00e0y nghỉ";
            colHolidayID.FieldName = "HolidayID";
            colHolidayID.Name = "colHolidayID";
            colHolidayID.OptionsColumn.AllowEdit = false;
            colHolidayID.OptionsColumn.AllowGroup = DefaultBoolean.False;
            colHolidayID.OptionsColumn.AllowIncrementalSearch = false;
            colHolidayID.OptionsColumn.AllowMerge = DefaultBoolean.False;
            colHolidayID.OptionsColumn.AllowSort = DefaultBoolean.False;
            colHolidayID.OptionsColumn.ReadOnly = true;
            colHolidayID.OptionsColumn.TabStop = false;
            colHolidayID.OptionsFilter.AllowAutoFilter = false;
            colHolidayID.OptionsFilter.AllowFilter = false;
            colHolidayName.Caption = "T\x00ean ng\x00e0y nghỉ";
            colHolidayName.FieldName = "HolidayName";
            colHolidayName.Name = "colHolidayName";
            colHolidayName.OptionsColumn.AllowEdit = false;
            colHolidayName.OptionsColumn.ReadOnly = true;
            colHolidayName.Visible = true;
            colHolidayName.VisibleIndex = 0;
            colHolidayName.Width = 0x111;
            colFromDate.Caption = "Từ ng\x00e0y";
            colFromDate.FieldName = "FromDate";
            colFromDate.Name = "colFromDate";
            colFromDate.OptionsColumn.AllowEdit = false;
            colFromDate.OptionsColumn.ReadOnly = true;
            colFromDate.Visible = true;
            colFromDate.VisibleIndex = 1;
            colFromDate.Width = 0x5b;
            colToDate.Caption = "Đến ng\x00e0y";
            colToDate.FieldName = "ToDate";
            colToDate.Name = "colToDate";
            colToDate.OptionsColumn.AllowEdit = false;
            colToDate.OptionsColumn.ReadOnly = true;
            colToDate.Visible = true;
            colToDate.VisibleIndex = 2;
            colToDate.Width = 0x57;
            colDescription.Caption = "Ghi ch\x00fa";
            colDescription.FieldName = "Description";
            colDescription.Name = "colDescription";
            colDescription.OptionsColumn.AllowEdit = false;
            colDescription.OptionsColumn.ReadOnly = true;
            colDescription.Visible = true;
            colDescription.VisibleIndex = 3;
            colDescription.Width = 0xc4;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(gcList);
            base.Controls.Add(barDockControlLeft);
            base.Controls.Add(barDockControlRight);
            base.Controls.Add(barDockControlBottom);
            base.Controls.Add(barDockControlTop);
            base.Name = "xucHoliday";
            base.Size = new Size(0x2b3, 0x1c0);
            barManager1.EndInit();
            repYear.EndInit();
            imageCollection2.EndInit();
            repMonth.EndInit();
            gcList.EndInit();
            gbList.EndInit();
            base.ResumeLayout(false);
        }

        private void LoadGrid()
        {
            gcList.DataSource = new DIC_HOLIDAY().GetByYear(m_Year);
        }

        private void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            LoadGrid();
        }

        private void repYear_EditValueChanged(object sender, EventArgs e)
        {
            LoadGrid();
        }

        private void repYear_EditValueChanging(object sender, ChangingEventArgs e)
        {
            m_Year = Convert.ToInt32(Convert.ToDateTime(e.NewValue.ToString()).Year.ToString());
        }

        private void SetMenu(Common.Class.RowClickEventArgs e)
        {
            object rowCellValue = gbList.GetRowCellValue(gbList.FocusedRowHandle, "HolidayID");
            DisableMenu(false);
            if (rowCellValue == null)
            {
                DisableMenu(true);
            }
        }

        private void ucList_ListKeyDown(object sender, KeyEventArgs key)
        {
            if (key.KeyCode == Keys.F2)
            {
                if (gbList.RowCount != 0)
                {
                    Change();
                }
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.E))
            {
                if (gbList.RowCount != 0)
                {
                    Change();
                }
            }
            else if (key.KeyCode == Keys.Enter)
            {
                if (gbList.RowCount != 0)
                {
                    Change();
                }
            }
            else if (key.KeyCode == Keys.F5)
            {
                ReLoad();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.N))
            {
                Add();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.T))
            {
                Add();
            }
        }

        private void UpdateRow(DIC_HOLIDAY item)
        {
            GridView gbList = this.gbList;
            int focusedRowHandle = this.gbList.FocusedRowHandle;
            gbList.SetRowCellValue(focusedRowHandle, "HolidayID", item.HolidayID);
            gbList.SetRowCellValue(focusedRowHandle, "HolidayName", item.HolidayName);
            gbList.SetRowCellValue(focusedRowHandle, "FromDate", item.FromDate);
            gbList.SetRowCellValue(focusedRowHandle, "ToDate", item.ToDate);
            gbList.SetRowCellValue(focusedRowHandle, "Description", item.Description);
            gbList.UpdateCurrentRow();
        }
    }
}